/* eslint-disable no-use-before-define */
import axios, { type Response } from '@/utils/axios/axios';

/** 获取今日数据监控列表 */
export function getDataMonitoringTodayData(): Promise<Response<DataMonitoringToday>> {
  return axios.get(`/system/datamonitoring/today`) as unknown as Promise<Response<DataMonitoringToday>>;
}

/** 获取累计监控数据 */
export function getDataMonitoringTotalData(): Promise<Response<DataMonitoringTotal>> {
  return axios.get(`/system/datamonitoring/total`) as unknown as Promise<Response<DataMonitoringTotal>>;
}

/** 获取累计监控数据 */
export function getDataMonitoringByDate(data: { timeRange: number; column: string }): Promise<Response<DataMonitoringByDate>> {
  return axios.post(`/system/datamonitoring/byDate`, data) as unknown as Promise<Response<DataMonitoringByDate>>;
}

export interface DataMonitoringToday {
  /**
   * 主键ID
   */
  id?: number;
  /**
   * 新增充值金额对比昨日
   */
  newRechargeAmtDiff?: number;
  /**
   * 新增充值订单数对比昨日
   */
  newRechargeOrderDiff?: number;
  /**
   * 新增用户数量
   */
  newUserCount?: number;
  /**
   * 新增用户数对比昨日
   */
  newUserDiff?: number;
  /**
   * 新增用户的充值总金额
   */
  newUserRechargeAmount?: number;
  /**
   * 新增用户中发生充值的用户数
   */
  newUserRechargeCount?: number;
  /**
   * 新增充值用户数对比昨日
   */
  newUserRechargeDiff?: number;
  /**
   * 新增用户的充值订单总数
   */
  newUserRechargeOrders?: number;
  /**
   * 全体用户充值金额对比昨日
   */
  rechargeAmtDiff?: number;
  /**
   * 全体用户充值订单数对比昨日
   */
  rechargeOrderDiff?: number;
  /**
   * 全体用户的充值总金额
   */
  totalRechargeAmount?: number;
  /**
   * 全体用户的充值订单总数
   */
  totalRechargeOrders?: number;
  /**
   * 更新时间
   */
  updateTime?: string;
}

export interface DataMonitoringTotal {
  /**
   * 累计收入
   */
  totalCount?: number;
  /**
   * 累计订单数
   */
  totalOrderNum?: number;
  /**
   * 累计用户数
   */
  totalUserNum?: number;
}

export interface DataMonitoringByDate {
  timePoint: string[];
  value: number[];
}
